package ge.telasi.tasks.ui.user;

import ge.telasi.tasks.model.User;
import ge.telasi.tasks.ui.comp.Hyperlink;
import ge.telasi.tasks.ui.UIUtils;

/**
 * @author dimitri
 */
public class UserLabel extends Hyperlink {
    private static final long serialVersionUID = 2557027144585839164L;
    private User user;

    public UserLabel() {}

    public UserLabel(User user) {
        setUser(user);
    }

    public void setUser(User user) {
        this.user = user;
        setText(user.getFullName() + " <" + user.getUsername() + ">");
    }

    @Override
    public void onClick() {
        UserPropertiesDialog dialog = new UserPropertiesDialog(this);
        dialog.setUser(user);
        UIUtils.openDialog(dialog);
    }
    
}
